package com.cssl.controller;

import cn.hutool.core.util.ObjectUtil;
import com.cssl.domain.dto.DtsAddressDto;
import com.cssl.domain.dto.DtsCollectDto;
import com.cssl.service.DtsAddressService;
import com.cssl.service.DtsCollectService;
import com.cssl.util.InfoCode;
import com.cssl.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/usercollect")
public class DtsCollectController {

    @Autowired
    private DtsCollectService dtsCollectService;

    @PostMapping("/listCollect")
    public Result getCollectList(@RequestBody DtsCollectDto dtsCollectDto) {
        Map collectList = dtsCollectService.getCollectList(dtsCollectDto);
        if (ObjectUtil.isEmpty(collectList.get("list"))) {
            return Result.result(InfoCode.QUERY_EMPTY, InfoCode.MESSAGE_QUERY_EMPTY, null, System.currentTimeMillis());
        }
        return Result.result(InfoCode.OK, InfoCode.MESSAGE_OK, collectList, System.currentTimeMillis());

    }
}
